﻿using System;
using System.Runtime.Serialization;

namespace Magellan.Routing
{
    [Serializable]
    public class InvalidRouteException : Exception
    {
        private readonly IRoute _route;
        private readonly RouteValidationResult _result;

        public InvalidRouteException(IRoute route, string message) : this(route, null, message)
        {
        }

        public InvalidRouteException(IRoute route, RouteValidationResult result, string message) : base(message)
        {
            _route = route;
            _result = result;
        }

        protected InvalidRouteException(
            SerializationInfo info,
            StreamingContext context) : base(info, context)
        {
        }

        public IRoute Route
        {
            get { return _route; }
        }

        public RouteValidationResult Result
        {
            get { return _result; }
        }
    }
}